package com.sunyur.tailor.channel.config.middle;

import com.sunyur.tailor.channel.common.middle.handler.InnerControllerHandler;
import com.sunyur.tailor.channel.common.middle.handler.OuterControllerHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 *
 * @Author 99288
 * @Description mvc配置
 * @Date 17:31 2021/7/20
 * @Param
 * @return
 **/
@Configuration
public class MvcConfig extends WebMvcConfigurationSupport {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(outerControllerHandler()).addPathPatterns("/outer/**");
        registry.addInterceptor(innerControllerHandler()).addPathPatterns("/http/**");
    }

    @Bean
    OuterControllerHandler outerControllerHandler(){
        return new OuterControllerHandler();
    }

    @Bean
    InnerControllerHandler innerControllerHandler(){
        return new InnerControllerHandler();
    }
}
